﻿Module dataReImpresion
    Public Function buscarIDArriendo(ByVal vID As Integer, ByVal vOpc As Integer) As Boolean
        Dim valRes As Boolean = False
        If vOpc = 0 Then

            conectar()


            cmd.Connection = con
            cmd.CommandText = "SELECT * FROM  tgastoscomunes WHERE IDPago = '" & vID & "' "
            dr = cmd.ExecuteReader

            If dr.Read Then
                valRes = True

            End If
            dr.Close()
            desconectar()

        ElseIf vOpc = 1 Then
            conectar()


            cmd.Connection = con
            cmd.CommandText = "SELECT * FROM tArriendo WHERE IDPagoRecibido = '" & vID & "' "
            dr = cmd.ExecuteReader

            If dr.Read Then
                valRes = True

            End If
            dr.Close()
            desconectar()
        End If
        Return valRes
    End Function


    Public Function buscarIDArriendo(ByVal vID As Integer, ByVal vID2 As Integer, ByVal vOpc As Integer) As Boolean
        Dim valRes As Boolean = False
        If vOpc = 0 Then

            conectar()


            cmd.Connection = con
            cmd.CommandText = "SELECT * FROM tgastoscomunes WHERE IDPago  Between '" & vID & "' And '" & vID2 & "' "
            dr = cmd.ExecuteReader

            If dr.Read Then
                valRes = True

            End If
            dr.Close()
            desconectar()

        ElseIf vOpc = 1 Then
            conectar()


            cmd.Connection = con
            cmd.CommandText = "SELECT * FROM tArriendo WHERE IDPagoRecibido Between '" & vID & "' And '" & vID2 & "' "
            dr = cmd.ExecuteReader

            If dr.Read Then
                valRes = True
            End If
            dr.Close()
            desconectar()
        End If
        Return valRes
    End Function



    Public Function buscarFechaArriendo(ByVal vf As String, ByVal vOpc As Integer) As Boolean
        Dim valRes As Boolean = False
        If vOpc = 0 Then

            conectar()


            cmd.Connection = con
            cmd.CommandText = "SELECT * FROM tpagosrecibidos WHERE Fecha= '" + vf + "' "
            dr = cmd.ExecuteReader

            If dr.Read Then
                valRes = True

            End If
            dr.Close()
            desconectar()

        ElseIf vOpc = 1 Then

            conectar()


            cmd.Connection = con
            cmd.CommandText = "SELECT * FROM tarriendo WHERE Fecha= '" + vf + "' "
            dr = cmd.ExecuteReader

            If dr.Read Then
                valRes = True

            End If
            dr.Close()
            desconectar()
        End If
        Return valRes
    End Function








    Public Function buscarFechaArriendo(ByVal vf As String, ByVal vf2 As String, ByVal vOpc As Integer) As Boolean
        Dim valRes As Boolean = False
        If vOpc = 0 Then

            conectar()


            cmd.Connection = con
            cmd.CommandText = "SELECT * FROM tpagosrecibidos WHERE fecha Between '" + vf + "' And '" + vf2 + "' "
            dr = cmd.ExecuteReader

            If dr.Read Then
                valRes = True

            End If
            dr.Close()
            desconectar()

        ElseIf vOpc = 1 Then
            conectar()


            cmd.Connection = con
            cmd.CommandText = "SELECT * FROM tArriendo WHERE Fecha Between '" + vf + "' And '" + vf2 + "' "
            dr = cmd.ExecuteReader

            If dr.Read Then
                MsgBox(dr.Item("IDPagoRecibido"))
                valRes = True

            End If
            dr.Close()
            desconectar()
        End If
        Return valRes
    End Function

End Module
